# $Id: PKGBUILD 169764 2012-10-28 01:11:11Z eric $
# Contributor: Eric Johnson <eric@coding-zone.com>
# Maintainer: Thayer Williams <thayer@archlinux.org>

pkgname=i8kmon
pkgver=1.33
pkgrel=5
pkgdesc="Tk-based daemon for i8kutils and Dell Inspiron/Latitude notebooks"
arch=('any')
url="http://packages.qa.debian.org/i/i8kutils.html"
license=('GPL2')
depends=('i8kutils' 'tk')
backup=('etc/i8kutils/i8kmon.conf' 'etc/conf.d/i8kmon')
source=(ftp://ftp.archlinux.org/other/i8kutils/i8kutils_$pkgver.tar.gz \
        i8kmon.daemon i8kmon.conf.d i8kmon.service)
sha1sums=('2701697dfe9c0e351cb412badd14fbf8191838c3'
          'a7ead36e31d27d85a257242847e316ea85a2426f'
          'a3a38c19f1af4bfc59ac8c88cadfa2e6ee185a4c'
          '5c20f5241de7e60b46117269f4e867b08734cdc8')

build() {
  cd "$srcdir/i8kutils-$pkgver"

  # conform to Arch Linux guidelines
  sed -i 's|/etc/i8kmon|/etc/i8kutils/i8kmon.conf|g' i8kmon.1
  sed -i 's|/etc/i8kmon.conf|/etc/i8kutils/i8kmon.conf|g' i8kmon
}

package() {
  cd "$srcdir/i8kutils-$pkgver"

  # no configure script, and Makefile has /usr hardcoded
  install -D -m755 i8kmon "$pkgdir/usr/bin/i8kmon"
  install -D -m644 i8kmon.conf "$pkgdir/etc/i8kutils/i8kmon.conf"
  install -D -m644 i8kmon.1 "$pkgdir/usr/share/man/man1/i8kmon.1"

  # install daemon script.
  install -D -m755 ../i8kmon.daemon "$pkgdir/etc/rc.d/i8kmon"
  install -D -m644 ../i8kmon.conf.d "$pkgdir/etc/conf.d/i8kmon"

  install -D -m644 ../i8kmon.service "$pkgdir/usr/lib/systemd/system/i8kmon.service"
}
